package edu.gdut.thesissys.vo;

import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Accreditation entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "accreditation", catalog = "gdutmis")
public class Accreditation extends BaseVo implements java.io.Serializable{

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 6095838761124497315L;
	private AccreditationId id;
	private Student student;
	private Teacher teacher;
	private String comment;
	private Double grade;
	private Date snateDate;
	private String types;

	// Constructors

	/** default constructor */
	public Accreditation() {
	}

	/** minimal constructor */
	public Accreditation(AccreditationId id, Student student, Teacher teacher) {
		this.id = id;
		this.student = student;
		this.teacher = teacher;
	}

	/** full constructor */
	public Accreditation(AccreditationId id, Student student, Teacher teacher,
			String comment, Double grade, Date snateDate, String types) {
		this.id = id;
		this.student = student;
		this.teacher = teacher;
		this.comment = comment;
		this.grade = grade;
		this.snateDate = snateDate;
		this.types = types;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "studentId", column = @Column(name = "student_id", nullable = false, length = 10)),
			@AttributeOverride(name = "teacherId", column = @Column(name = "teacher_id", nullable = false, length = 10)) })
	public AccreditationId getId() {
		return this.id;
	}

	public void setId(AccreditationId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "student_id", nullable = false, insertable = false, updatable = false)
	public Student getStudent() {
		return this.student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "teacher_id", nullable = false, insertable = false, updatable = false)
	public Teacher getTeacher() {
		return this.teacher;
	}

	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}

	@Column(name = "comment", length = 65535)
	public String getComment() {
		return this.comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	@Column(name = "grade", precision = 5)
	public Double getGrade() {
		return this.grade;
	}

	public void setGrade(Double grade) {
		this.grade = grade;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "snate_date", length = 10)
	public Date getSnateDate() {
		return this.snateDate;
	}

	public void setSnateDate(Date snateDate) {
		this.snateDate = snateDate;
	}

	@Column(name = "types", length = 1)
	public String getTypes() {
		return this.types;
	}

	public void setTypes(String types) {
		this.types = types;
	}

}